
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>app1_index.jsp</title>
</head>
<body>
<!--
  <a href="http://localhost:3000/auth?client_id=1&redirect_uri=http://localhost:8080/app2.html&scope=openid profile&response_type=code&state=455356436">登录</a>
 -->
<input type="button" value="APP2用起来吧！" id="go"/>
</body>
</html>
<script type="text/javascript">
document.getElementById("go").onclick = function() {
    console.log("去OIDC provider判断是否登陆了");
/*
    let storage = Window.localStorage;
    localStorage.setItem("sub", sub);
*/
    let storage = window.localStorage;
    let sub = storage.getItem("sub");
    let encodedURI = encodeURI('http://localhost:8899/app2/receiveAuthCode');
    window.location.href = 'http://localhost:8899/oidcProvider/auth?client_id=app1&redirect_uri=' + encodedURI + '&scope=openid profile&response_type=code&sub=' + sub;
}
</script>